const app = getApp();
const URL = app.globalData.URL;

let orderList = [
  {
    time: '2019.4.11 12:09',
    state: '待付款',
    sum: '1096.00',
    total: 2,
    commodity: [
      {
        title: '车电一体499',
        description: '499.00/期',
        price: '499.00',
        num: '1',
        image:
          'https://gw.alipayobjects.com/mdn/rms_107da2/afts/img/A*DenfRpLr6NEAAAAAAAAAAABkARQnAQ',
      },
      {
        title: '车电一体499',
        description: '499.00/期',
        price: '499.00',
        num: '1',
        image:
          'https://gw.alipayobjects.com/mdn/rms_107da2/afts/img/A*6HXWRKGCK-oAAAAAAAAAAABkARQnAQ',
      },
    ],
  },
  {
    time: '2019.4.11 12:09',
    state: '待收货',
    sum: '1096.00',
    total: 2,
    commodity: [
      {
        title: '车电一体499',
        description: '499.00/期',
        price: '499.00',
        num: '1',
        image:
          'https://gw.alipayobjects.com/mdn/rms_107da2/afts/img/A*DenfRpLr6NEAAAAAAAAAAABkARQnAQ',
      },
      {
        title: '车电一体499',
        description: '499.00/期',
        price: '499.00',
        num: '1',
        image:
          'https://gw.alipayobjects.com/mdn/rms_107da2/afts/img/A*6HXWRKGCK-oAAAAAAAAAAABkARQnAQ',
      },
    ],
  },
];

Page({
  data: {
    tabs: ['商品列表'],
    activeTab: 0, 
    titleOpacity: 1,
    shadow: false,
    orderList: orderList,
  },
  onLoad() {},
  onTabBarTap(e) {
    const { index } = e.target.dataset
    let sList = []
    if(index == 0){
      sList = orderList
    }else if(index == 1){
      sList[0] = orderList[0]
    }else if(index == 2){
      sList[0] = orderList[1]
    }else if(index == 3){
      sList[0] = orderList[2]
    }else if(index == 4){
      sList[0] = orderList[3]
    }else if(index == 5){
      sList[0] = orderList[4]
    }

    
    this.setData({
      activeTab: index,
      orderList: sList
    });
  },
});
